<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript" charset="utf-8" src="<c:url value='/js/plug/ueditor/ueditor.config.js'/>"></script>
<script type="text/javascript" charset="utf-8" src="<c:url value='/js/plug/ueditor/ueditor.all.js'/>"></script>

<div class="easyui-layout" style="width: 100%; height: 100%;" fit="true">
	<div data-options="region:'center',title:'',split:true" style="height: 100%;">
		<form id="intrductionForm" method="post">
			<input type="hidden" name="newsTypeId">
			<table class="detailTable">
				<tr>
					<th style="width: 120px;">内容名称:</th>
					<td colspan="3" id="newsTitle"></td>
				</tr>
				<tr>
					<th style="width: 120px;">打开方式:</th>
					<td colspan="3" >
						<input type="radio" name="openMedth">当前页
						<input type="radio" name="openMedth">新窗口
					</td>
				</tr>
				<tr>
					<th>内容:</th>
					<td colspan="3">
						<textarea name="descript" id="descript" style="width:100%;height:300px;"></textarea>
					</td>
				</tr>
				
				<tr>
					<td align="right" colspan="4">
						<input type="button" onclick="submitForm()" class="button" value="提交">
						<input type="button" onclick="pms.resetForm('form')" class="button" value="重置">
					</td>
				</tr>
			</table>
			
		</form>
	</div>
</div>

<script type="text/javascript">
$(function(){

	//初始获取数据
	var param = {"newsTypeId":${param.newsTypeId}}
	$.pmsAjax({
		url : '<c:url value="/newstype/showCmsTypeDetail.do"/>',
		data : param,
		success : function(data) {
			if(data.code=="200"){
				var ret = data.data.detail;
				$('#intrductionForm').form('load', ret);
				$("#newsTitle").text(ret.name);
				UE.getEditor('descript',{serverUrl: '<c:url value="/js/plug/ueditor/jsp/controller.jsp"/>',UEDITOR_HOME_URL:'<c:url value="/js/plug/ueditor/"/>'});
				
			}else{
				parent.alertError(data.result);
				//$("#w_form_descript").dialog('close');
			}
		}
	});
});

//提交
function submitForm(){
	$('#intrductionForm').form('submit', {
	    url:'<c:url value="/newstype/updateEmBNewsType.do"/>',
	    onSubmit: function(param){
	    	if(!$("#intrductionForm").form('validate')){
	    		return false;
	    	}
	    },
	    dataType : 'json',
	    success:function(data){
		    var ret = eval("("+data+")");
	     	if(ret.code=="200"){
	     		parent.alertShow(ret.result);
	     		parent.$("#w_form_descript").dialog('close');
		    }else{
		    	alertError(ret.result);
			}
	    }
	});
}
</script>

